home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 7
/
Apprentice-Release7.iso
/
Demos
/
Component Software
/
FileFlex 2.0.3.sit
/
FileFlex 2.0.3
/
Unsupported & Undocumented
/
Char Translation Example
/
00002_Script_2
< prev
next >
Wrap
Text File
|
1996-04-10
|
1KB
|
43 lines
on buildTranslateTable_ASCIIX
global ASCIIX
put "" into theTable
repeat with i = 0 to 255
if i = 0 then
put numToChar(255) after theTable -- always use 255 in byte 0
else
put numToChar(i) after theTable -- position in table
end if
end repeat
put theTable into ASCIIX
end buildTranslateTable_ASCIIX
on buildTranslateTable_CaseReverseX
global CaseReverseX, ASCIIX
buildTranslateTable_ASCIIX
put ASCIIX into theTable
-- fill in lower case
repeat with i = 65 to 90
put numToChar(i+32) into char i+1 of theTable
-- using i+1 above because strings begin at 1, not 0
end repeat
-- fill in upper case
repeat with i = 97 to 122
put numToChar(i-32) into char i+1 of theTable
end repeat
put theTable into CaseReverseX
end buildTranslateTable_CaseReverseX
on showTable theTable
repeat with i = 1 to 256
put padNum(i-1) & ": " into tableRecord
put padNum(charToNum(char i of theTable)) after tableRecord
put " " & char i of theTable after tableRecord
put tableRecord
end repeat
end showTable
on padNum num
if num < 10 then return "00" & string(num)
if num < 100 then return "0" & string(num)
return string(num)
end padNum